Skip to content

Conversation

@lawrence-forooghian
Copy link
Collaborator

Summary

This PR adds specification points for applying LiveObjects operations immediately upon receiving the ACK, before the echo arrives over the Realtime connection. This implements the decision from LODR-054.

Motivation

Currently, the LiveObjects SDK only applies operations when received over the Realtime connection (the echo), which means users cannot immediately read their own writes. This causes issues in agentic applications where subsequent operations depend on previous updates being applied locally.

Implementation

This PR implements Option 1 from the decision record: Store the serials of all applied-on-ACK operations in a sliding window.

Changes

objects-features.textile

  • RTO3c: Add appliedOnAckSerials set to track operations applied on ACK but not yet echoed
  • RTO3d: Add siteCode storage from ConnectionDetails for siteTimeserials checks
  • RTO20: Define rules for applying operations on ACK with idempotency checks
  • RTO21: Define ACK buffering during SYNCING state to prevent applying to stale state
  • RTO9a0: Check appliedOnAckSerials before applying echoed operations to avoid duplicates
  • Update sync-related spec points (RTO4b, RTO5a2, RTO5c) to clear appliedOnAckSerials and BufferedAcks

features.textile

  • CD2j: Add siteCode field to ConnectionDetails (implements AIT-281)

Next Steps

  • Implement in ably-js
  • Write SDK spec tests

Related

🤖 Generated with Claude Code

lawrence-forooghian and others added 2 commits January 16, 2026 09:50
Written by Claude based on JS at 194aed7 (i.e. the commit into which the
path-based API was merged in a9aea33).
This implements the decision from LODR-054 to apply operations to local
objects immediately upon receiving the ACK, before the echo arrives over
the Realtime connection. This ensures that when operation promises
resolve, the local state has already been updated.

Changes to objects-features.textile:
- RTO3c: Add appliedOnAckSerials set to track operations applied on ACK
- RTO3d: Add siteCode storage for siteTimeserials checks
- RTO20: Define rules for applying operations on ACK
- RTO21: Define ACK buffering during SYNCING state
- RTO9a0: Check appliedOnAckSerials before applying echoed operations
- Update sync-related spec points to clear appliedOnAckSerials and BufferedAcks

Changes to features.textile:
- CD2j: Add siteCode field to ConnectionDetails

Related: https://ably.atlassian.net/browse/AIT-281

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@lawrence-forooghian
Copy link
Collaborator Author

@claude are you able to make changes to this PR?

** @(CD2g)@ @serverId@ string is a unique identifier for the front-end server that the client has connected to. This server ID is only used for the purposes of debugging
** @(CD2h)@ @maxIdleInterval@ is the maximum length of time in milliseconds that the server will allow no activity to occur in the server->client direction. After such a period of inactivity, the server will send a @HEARTBEAT@ or transport-level ping to the client. If the value is 0, the server will allow arbitrarily-long levels of inactivity.
** @(CD2i)@ @objectsGCGracePeriod@ integer - the length of time, in milliseconds, that the client library must wait before releasing resources for tombstoned objects and map entries (see "RTO10":../objects-features#RTO10)
** @(CD2j)@ @siteCode@ string - the identifier for the regional site that the connection is connected to. This is used when applying operations on ACK to perform the @siteTimeserials@ check (see "RTO3d":../objects-features#RTO3d, "RTO20a":../objects-features#RTO20a)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude we don't need the links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants